CONTENTS | INDEX | PREV | NEXT
ctime
NAME
ctime - convert time into standard text
SYNOPSIS
char *str = ctime(&t);
time_t t;
FUNCTION
ctime converts a time pointer into ascii text using the following
format:
Sun Dec 8 01:53:33 1987n0
where n stands for a newline character and 0 is terminating
nul.
The string is stored in a static buffer shared by both asctime and
ctime and so will get overwritten whenever either function is
called.
EXAMPLE
/*
* since the string returned by ctime already has a newline on
* it we use fputs instead puts.
*/
#include <stdio.h>
#include <time.h>
main()
{
time_t t = time(NULL);
fputs(ctime(&t), stdout);
return(0);
}
INPUTS
time_t *t; pointer to a time_t value
RESULTS
char *str; pointer to static string
SEE ALSO
time, localtime, asctime, strftime, clock